<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html style="overflow:hidden">
<head>
    <title>$!app_name</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- 框架 -->
    <link href="${base}/include/css/msg.css" rel="stylesheet" type="text/css"/>
    <link href="${base}/include/css/default.css" rel="stylesheet" type="text/css"/>
	<script type='text/javascript'>
		var CONTEXTPATH = '${base}';
	</script>
    <script src="${base}/include/js/main.js"></script>
    <script src="${base}/include/js/string.js"></script>
	<!-- 分页  注意顺序 -->
	<link href="${base}/include/css/themes/gray/easyui.css" rel="stylesheet" type="text/css"/> 	
	<script src="${base}/include/js/jquery.easyui.min.js"></script>	
    <script src="${base}/include/js/jquery.datagrid.js"></script>
    <!-- 树 -->
    <script type="text/javascript" src="${base}/include/controls/ztree/jquery.ztree.core-3.5.min.js"></script> 
	<link rel="stylesheet" href="${base}/include/controls/ztree/zTreeStyle/zTreeStyle.css" type="text/css">

    <script>
    	function xuanze(){
    	
    		 //转到新增页面
    		
    		 var d = new Dialog("Button");
    	        d.Width = 420;
    	        d.Height = 230;
    	        d.Title = "增加按钮";
    	        d.URL = "${base}/private/sys/resourceButton.html";
    	        d.OKEvent = function() {
    	        	 $("#button2").val($DW.$("#similar").val());
    	            //var dc = $DW.Form.getData("form1");
    	            $D.close();
    	        }
    	        d.onLoad = function() {
    	        	
    	        	var btval=$("#button2").val();
    	        	 var arr = btval.split(";");
    	        	 for(var i=0;i<arr.length-1;i++){
    	        		 var oOption=$("<OPTION></OPTION>");
    	        		   oOption.text(arr[i]+";");
    	        		   oOption.val(arr[i]+";");
    	        		   $DW.$("#fjmu").append(oOption);
    	        		  
    	        	 }
    	        	 $DW.$("#similar").val($("#button2").val());
    	           
    	        }
    	        
    	        d.show();
    	    }
     	function loadData(){
     		jQuery.ajax({
      			url : "${base}/private/sys/res/list?subtype="+Page.getValue("subtype"),
      		
      			success : function (res) {  
      				var selector=$("#id");  
      				var json = jQuery.parseJSON(res);
      				var str="";
      				selector.empty();
      				selector.append("<option value=\"\">无</option> ");
      				jQuery.each(json, function(index, obj) {
      					 str=gettreecode(obj.id)+obj.name;
      					 selector.append("<option value=\""+obj.id+"\">"+str+"</option>");
      				});
      				 
      				return false;
      			},
      			fail : function(res) {
      				Dialog.alert("系统错误?!");
      			}
      		});
     		
     	}
     	Page.onLoad(function() {
     	   loadData();
     	   
          });
    </script>
</head>
 <body class="dialogBody">
	  <form name='form1' id="form1" method='post'>
       <input type="hidden" name="button" id="button" value=""/>
      
        
    <table width="100%" height="100%" border="0">
		<tr>
			<td valign="middle">
			<table align="center" cellpadding="2"
				cellspacing="0">
				<tr>
					<td width="104" height="10"></td>
					<td width="6"></td>
					<td></td>
				</tr>
				<tr>
					<td align="right">菜单名称：</td>
					<td>&nbsp;</td>
					<td width="260"><input type="text" name="name" id="name" size="30" maxlength="50"   verify="菜单名称|NotNull"></td>
				</tr>
				<tr>
					<td align="right">菜单URL：</td>
					<td>&nbsp;</td>
					<td>  <input type="text" name="url" id="url" size="50"  maxlength="100"  >
					</td>
				</tr>
				<tr>
					<td align="right">菜单类型：</td>
					<td>&nbsp;</td>
					<td><select name="subtype" id="subtype" onchange="loadData()">
                        <option value="0" >系统资源</option>
                        <option value="1" selected>业务资源</option>
                        </select>
                          </td>
                       
				</tr>
<tr>
					<td align="right">上级菜单：</td>
					<td>&nbsp;</td>
					<td><select name="id" id="id">
                        
					</select>
					</td>
				</tr>
                
                  <tr>
					<td align="right">状态：</td>
					<td>&nbsp;</td>
					<td><select name="state" id="state">
                         <option value="0">激活</option>
                        <option value="1">冻结</option>
                        </select>
                     </td>
				</tr>
				<tr>
					<td align="right">按钮：</td>
					<td>&nbsp;</td>
					<td><textarea rows="1" cols="25" name="button2" id="button2" readonly="readonly">$!obj.button</textarea>
					<input type="button" value="选择按钮" onclick="xuanze()"/>
                     </td>
				</tr>
				<tr>
					<td align="right">备注：</td>
					<td>&nbsp;</td>
					<td> <textarea rows="4" cols="40" name="descript" id="descript"> </textarea></td>
				</tr>
				<tr>
					<td colspan="3" align="center" height="10"></td>
				</tr>
			</table>
			</td>
		</tr>
	</table>
	</form>
	</body> 
</html>